package com.example.yuejian21.nongfusanquan.yuejian21.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.Menu;
import android.view.View;
import android.view.ViewDebug;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.yuejian21.nongfusanquan.yuejian21.R;
import com.example.yuejian21.nongfusanquan.yuejian21.fragment.ActivityFragment;
import com.squareup.picasso.Picasso;

/**
 * Created by Nongfusanquan on 2017-10-12.
 */

public class MatchdetailActivity extends AppCompatActivity {
    private TextView matchdetail_name,text_matchdetail_tel,matchdetail_tel,matchdetail_info,text_matchdetail_info,
            text_matchdetail_address,matchdetail_address;
    private Button matchdetail_return;
    private ImageView matchdetail_pic;


    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_matchdetail);
        initViews();
        initEvent();
        getData();

    }
    private void initViews(){
        matchdetail_name=(TextView)findViewById(R.id. matchdetail_name);
        text_matchdetail_tel=(TextView)findViewById(R.id.text_matchdetail_tel);
        matchdetail_tel=(TextView)findViewById(R.id. matchdetail_tel);
        matchdetail_info=(TextView)findViewById(R.id. matchdetail_info);
        matchdetail_return=(Button)findViewById(R.id.return_matchdetail);
        matchdetail_pic=(ImageView)findViewById(R.id. matchdetail_pic);
        matchdetail_address=(TextView)findViewById(R.id. matchdetail_num);
        text_matchdetail_address=(TextView)findViewById(R.id.text_match_number);
        text_matchdetail_info=(TextView)findViewById(R.id.text_matchdetail_info);
    }

    private void initEvent(){
        matchdetail_return.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
    }
    private void getData() {
        Bundle bundle = this.getIntent().getExtras();
        String aname = bundle.getString("m_name");
        String phone = bundle.getString("m_phone");
        String aintro =bundle.getString("m_info");
        String aaddress =bundle.getString("m_address");
        String apicture = "http://10.0.2.2/yuejian14/Public/Admin/matchpicture/"+bundle.getString("m_pic");

        matchdetail_name.setText(aname);
        matchdetail_tel.setText(phone);
        matchdetail_info.setText(aintro);
        matchdetail_address.setText(aaddress);



        Picasso.with(this).load(apicture).into(matchdetail_pic);
    }

}
